//version:1.0.0
    export default {
        data() {
            return {
                form:{
                    lc61aac001: {
                        value: '',
                        p: 'H'
                    },
                    aac003: {
                        value: '',
                        p: 'D'
                    },
                    aac004: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                     aac005: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    aac058: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    aac147: {
                        value: '',
                        p: 'D'
                    },
                    aae006: {
                        value: '',
                        p: 'D'
                    },
                    aae005: {
                        value: '',
                        p: 'D'
                    },
                    aae007: {
                        value: '',
                        p: 'D'
                    },
                    aac007: {
                        value: '',
                        p: 'D'
                    },
                    aab069: {
                        value: '',
                        p: 'D'
                    },
                    bab010: {
                        value: '',
                        p: 'D'
                    },
                    aae004: {
                        value: '',
                        p: 'D'
                    },
                    bae566: {
                        value: '',
                        p: 'D'
                    },
                    aae006: {
                        value: '',
                        p: 'D'
                    },
                    aae007: {
                        value: '',
                        p: 'D'
                    },
                    aab013: {
                        value: '',
                        p: 'D'
                    },
                    alc009: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    aac042: {
                        value: '',
                        p: 'D'
                    },
                    bae565: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    aac044: {
                        value: '',
                        p: 'D'
                    },
                    acl049: {
                        value: '',
                        p: 'D'
                    },
                    blc027: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    alc021: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    aca111: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    alc042: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    alc043: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    alc044: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    alc046: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    alc047: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    alc022: {
                        value: '',
                        p: 'D'
                    },
                    ala028: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    blb003: {
                        value: '',
                        p: 'D'
                    },
                    blc542: {
                        value: '',
                        p: 'D'
                    },
                    alc020: {
                        value: '',
                        p: 'D'
                    },
                    blc543: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    alc006: {
                        value: '',
                        p: 'D'
                    },
                    alc030: {
                        value: '',
                        p: 'D'
                    },
                    aae030: {
                        value: '',
                        p: 'D'
                    },
                    blc508: {
                        value: '',
                        p: 'D'
                    },
                    blc150: {
                        value: '',
                        p: 'D'
                    },
                    alc048: {
                        value: '',
                        p: 'D'
                    },
                    ala017: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    ala029: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    alc040: {
                        value: '',
                        p: 'D'
                    },
                    ala015: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    ala016: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    hsqk: {
                        value: '',
                        p: 'D'
                    },
                    blc566: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    blc567: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    blc569: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    aae123: {
                        value: '',
                        p: 'D'
                    },
                    aae124: {
                        value: '',
                        p: 'D'
                    },
                    SHBZ: {
                        key: '',
                        value: '',
                        p: 'R'
                    },
                    blc500: {
                        value: '',
                        p: 'E'
                    },

                },
                panel: {},

                rules:{
                    aac003: [
                         { validator: this.$rules.test_noBlank, trigger: 'blur'}

                    ],
                    aac058: [
                         { validator: this.$rules.test_noBlank, trigger: 'change'}

                    ],
                    aac147: [
                         { validator: this.$rules.test_noBlank, trigger: 'blur'}

                    ],
                    aae006: [
                         { validator: this.$rules.test_noBlank, trigger: 'blur'}

                    ],
                    aac007: [
                         { validator: this.$rules.test_noBlank, trigger: 'blur'}

                    ],
                    bae566: [
                         { validator: this.$rules.test_noBlank, trigger: 'blur'}

                    ],
                    aae006: [
                         { validator: this.$rules.test_noBlank, trigger: 'blur'}

                    ],
                    alc009: [
                         { validator: this.$rules.test_noBlank, trigger: 'change'}

                    ],
                    aac042: [
                         { validator: this.$rules.test_noBlank, trigger: 'blur'}

                    ],
                    bae565: [
                         { validator: this.$rules.test_noBlank, trigger: 'change'}

                    ],
                    aac044: [
                         { validator: this.$rules.test_noBlank, trigger: 'blur'}

                    ],
                    acl049: [
                         { validator: this.$rules.test_noBlank, trigger: 'blur'}

                    ],
                    blc027: [
                         { validator: this.$rules.test_noBlank, trigger: 'change'}

                    ],
                    alc021: [
                         { validator: this.$rules.test_noBlank, trigger: 'change'}

                    ],
                    aca111: [
                         { validator: this.$rules.test_noBlank, trigger: 'change'}

                    ],
                    alc042: [
                         { validator: this.$rules.test_noBlank, trigger: 'change'}

                    ],
                    alc020: [
                         { validator: this.$rules.test_noBlank, trigger: 'blur'}

                    ],
                    alc030: [
                         { validator: this.$rules.test_noBlank, trigger: 'blur'}

                    ],
                    SHBZ: [
                         {required: true, validator: this.$rules.test_noBlank, trigger: 'change'}

                    ],

                },
                codeTypes:{
                    AAC004:[],
                    AAC005:[],
                    AAC058:[],
                    ALC009:[],
                    BAE565:[],
                    BLC027:[],
                    ALC021:[],
                    ACA111:[],
                    ALC042:[],
                    ALC043:[],
                    ALC044:[],
                    ALC046:[],
                    ALC047:[],
                    ALA028:[],
                    BLC543:[],
                    ALA017:[],
                    ALA015:[],
                    ALA016:[],
                    BLC566:[],
                    BLC567:[],
                    BLC569:[],
                    SHBZ:[],

                },
                codeTypeFilters:{

                },
                pager: {
	                page: 1,
	                size: 10
            	},
            	total: 0,
            }
        },
        computed: {
            functionId() {
                if (this.$store.getters.init.path !== this.$route.path) return;
                if (this.$store.getters.init.mdParam === null || this.$store.getters.init.mdParam === undefined) return;
                if (this.$store.getters.init.mdParam.functionid === undefined) return;
                return this.$store.getters.init.mdParam.functionid;
            },
            backFun() {
                return this.$store.getters.backFun;
            },
            init_formData() {
                if (this.$store.getters.init.path !== this.$route.path)  return;
                return this.$store.getters.init.form;
            },
            doInitformData: {
                get: function () {
                    if (this.$store.getters.common === null) return [];
                    if (this.$store.getters.common.path !== this.$route.path) return;
                    return this.$store.getters.common.formData;
                },
                set: function (newValue) {
                    if (newValue.path !== this.$route.path) return;
                    return newValue;
                }
            },
            init_panel() {
                if (this.$store.getters.init.path !== this.$route.path)  return;
                return this.$store.getters.init.panel;
            },
            doInitpanel: {
                get: function () {
                    if (this.$store.getters.common === null) return [];
                    if (this.$store.getters.common.path !== this.$route.path) return;
                    return this.$store.getters.common.panel;
                },
                set: function (newValue) {
                    if (newValue.path !== this.$route.path) return;
                    return newValue;
                }
            },

        },
        created() {
            let param = {
                path: this.$route.path,
                codeTypes:this.codeTypes,
                codeTypeFilters: window.btoa(JSON.stringify(this.codeTypeFilters)),
                form:this.form,
                panel:this.panel

            };
            if (this.$route.query.keepAlive === undefined) {
                this.$store.dispatch('SET_INIT', param);
            }
        },
        watch: {
            init_formData: {
                handler(value) {
                    if (value == undefined) return;
                    this.getformData(value);
                },
                deep: true
            },
            doInitformData: {
                handler(value) {
                    if (value == undefined) return;
                    this.getformData(value);
                },
                deep: true
            },
            init_panel: {
                handler(value) {
                    if (value == undefined) return;
                    this.getpanel(value);
                },
                deep: true
            },
            doInitpanel: {
                handler(value) {
                    if (value == undefined) return;
                    this.getpanel(value);
                },
                deep: true
            },

            backFun: {
                handler(value) {
                    if (value === null) return;
                    this.customBackFun();
                    let backFun = [];
                    backFun = value.split(',');
                    if (backFun.indexOf('rDoInit') >= 0) {
                let codeTypes = {
                    AAC004:[],
                    AAC005:[],
                    AAC058:[],
                    ALC009:[],
                    BAE565:[],
                    BLC027:[],
                    ALC021:[],
                    ACA111:[],
                    ALC042:[],
                    ALC043:[],
                    ALC044:[],
                    ALC046:[],
                    ALC047:[],
                    ALA028:[],
                    BLC543:[],
                    ALA017:[],
                    ALA015:[],
                    ALA016:[],
                    BLC566:[],
                    BLC567:[],
                    BLC569:[],
                    SHBZ:[],

                };
                let form = {
                    lc61aac001: {
                        value: '',
                        p: 'H'
                    },
                    aac003: {
                        value: '',
                        p: 'D'
                    },
                    aac004: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                     aac005: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    aac058: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    aac147: {
                        value: '',
                        p: 'D'
                    },
                    aae006: {
                        value: '',
                        p: 'D'
                    },
                    aae005: {
                        value: '',
                        p: 'D'
                    },
                    aae007: {
                        value: '',
                        p: 'D'
                    },
                    aac007: {
                        value: '',
                        p: 'D'
                    },
                    aab069: {
                        value: '',
                        p: 'D'
                    },
                    bab010: {
                        value: '',
                        p: 'D'
                    },
                    aae004: {
                        value: '',
                        p: 'D'
                    },
                    bae566: {
                        value: '',
                        p: 'D'
                    },
                    aae006: {
                        value: '',
                        p: 'D'
                    },
                    aae007: {
                        value: '',
                        p: 'D'
                    },
                    aab013: {
                        value: '',
                        p: 'D'
                    },
                    alc009: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    aac042: {
                        value: '',
                        p: 'D'
                    },
                    bae565: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    aac044: {
                        value: '',
                        p: 'D'
                    },
                    acl049: {
                        value: '',
                        p: 'D'
                    },
                    blc027: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    alc021: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    aca111: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    alc042: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    alc043: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    alc044: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    alc046: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    alc047: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    alc022: {
                        value: '',
                        p: 'D'
                    },
                    ala028: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    blb003: {
                        value: '',
                        p: 'D'
                    },
                    blc542: {
                        value: '',
                        p: 'D'
                    },
                    alc020: {
                        value: '',
                        p: 'D'
                    },
                    blc543: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    alc006: {
                        value: '',
                        p: 'D'
                    },
                    alc030: {
                        value: '',
                        p: 'D'
                    },
                    aae030: {
                        value: '',
                        p: 'D'
                    },
                    blc508: {
                        value: '',
                        p: 'D'
                    },
                    blc150: {
                        value: '',
                        p: 'D'
                    },
                    alc048: {
                        value: '',
                        p: 'D'
                    },
                    ala017: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    ala029: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    alc040: {
                        value: '',
                        p: 'D'
                    },
                    ala015: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    ala016: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    hsqk: {
                        value: '',
                        p: 'D'
                    },
                    blc566: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    blc567: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    blc569: {
                        key: '',
                        value: '',
                        p: 'D'
                    },
                    aae123: {
                        value: '',
                        p: 'D'
                    },
                    aae124: {
                        value: '',
                        p: 'D'
                    },
                    SHBZ: {
                        key: '',
                        value: '',
                        p: 'R'
                    },
                    blc500: {
                        value: '',
                        p: 'E'
                    },

                };
                let panel= {};

            let param = {
                path: this.$route.path,
                codeTypes:codeTypes,
                codeTypeFilters: window.btoa(JSON.stringify(this.codeTypeFilters)),
                form:form,
                panel:panel

            };
                        this.$store.dispatch('SET_INIT', param);
                    }
                }
            }
        },
        mounted() {
            if (this.$store.getters.cacheData === null) return;
            if (this.$store.getters.cacheData[this.$route.path] === undefined)  return;
            if (this.$store.getters.cacheData[this.$route.path].path !== this.$route.path) return;
            if (this.$store.getters.cacheData[this.$route.path].form !== undefined) {
                this.getformData(this.$store.getters.cacheData[this.$route.path].form);
            }
            if (this.$store.getters.cacheData[this.$route.path].panel !== undefined) {
                this.getpanel(this.$store.getters.cacheData[this.$route.path].panel);
            }

        },
        beforeRouteLeave(to, from, next) {
            let param = {
                path: this.$route.path,
                codeTypes: this.$store.getters.codeTypes,
                codeTypeFilters: window.btoa(JSON.stringify(this.codeTypeFilters)),
                form:this.form,
                panel:this.panel

            };
            if (from) {
                this.$store.dispatch('SET_CACHEDATA', param);
            }
            next();
        },
        methods: {
            getformData(value) {
                this.form = value;
            },
            getpanel(value) {
                this.panel = value;
            },


            handleSizeChange(val) {
                console.log(`每页 ${val} 条`);
            },
            handleCurrentChange(val) {
                console.log(`当前页: ${val}`);
            },
            handleEdit(id) {
                this.dialogFormVisible = true;
            },
            formValidate(value){
                if(value && value.length>0){
                    let btn = true;
                    value.forEach((item,index)=>{
                        if(!btn) return
                        this.$refs[item].validate((valid) => {
                            if (valid) {
                                btn = true;
                            } else {
                                btn = false;
                            }
                        });
                    })
                    if(btn) this.$refs.save.btn();
                }
            },

            customBackFun(){//自定义方法体
},
        },
    }
